<template>
    <div class="newsinfo-constornal">
            <h2 class="newsinfo-title">{{newInfoList.title}}</h2>
            <p class="newsinfo-date">
                <span>{{newInfoList.add_time|dateFormat}}</span>
                <span>{{newInfoList.click}}次</span>
            </p>
            <hr>
            <div class="content" v-html="newInfoList.content">
            </div>
            <comment :id="id"></comment>
    </div>
</template>
<script>
    import comment from '../tool/Comment.vue'
    export default {
        data() {
            return {
                newInfoList: {}
            }
        },
        created() {
            this.getnew()
        },
        components: {
            comment
        },
        methods: {
            //获取新闻列表
            async getnew() {
                const {
                    data
                } = await this.$http.get('api/getnew/' + this.id)
                if (data.status === 0) this.newInfoList = data.message[0]

            }
        },
        props: ['id']
    }
</script>
<style lang="scss" scoped>
    .newsinfo-constornal {
        padding: 0 6px;
        .newsinfo-title {
            font-size: 15px;
            text-align: center;
            line-height: 35px;
            color: #ccc;
        }
        .newsinfo-date {
            display: flex;
            justify-content: space-between;
        }
    }
</style>